package com.mzpai.web.onlineutil;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

import com.csvreader.CsvReader;
import com.mzpai.util.ChineseCharacterUtil;

public class TestRead {

	public static void main(String[] args) {
		String path = "D:\\pythontest\\imgs\\dog\\zhuliang\\guochan\\dog_info.csv";
		readBrandName(path,"gbk");
		
//		String str=ChineseCharacterUtil.convertHanzi2Pinyin(pinpai,false).toUpperCase();
//        String first=str.substring(0,1);
	}
	
	public static List<String> readBrandName(String filePath,String encoding){
		List<String> liststr=new ArrayList<String>();
		
		try {
            // 创建CSV读对象
            CsvReader csvReader = new CsvReader(filePath, ',', Charset.forName(encoding));
            // 读表头
            csvReader.readHeaders();
            while (csvReader.readRecord()) {
                String pinpai = csvReader.get("pinpai").trim();//品牌
                if(!liststr.contains(pinpai)){
                	liststr.add(pinpai);
                	System.out.println(pinpai);
                }
            }
        } catch (Exception e) {
        }
	  return liststr;	
	}
	
}
